from django.db import models
from myutils.base_model import BaseModel
# Create your models here.

class Role(models.Model):
    name = models.CharField(max_length=32)
    class Meta:
        db_table = 'role'

    def __str__(self):
        return self.name
class ComeFrom(models.Model):
    name = models.CharField(max_length=30)
    class Meta:
        db_table = 'comefrom'

    def __str__(self):
        return self.name

class AuthUser(models.Model):
    auth_uid = models.CharField(max_length=60)
    auth_name = models.CharField(max_length=30)
    role = models.ForeignKey(Role,on_delete=models.CASCADE)
    comefrom = models.ForeignKey(ComeFrom,on_delete=models.CASCADE)
    class Meta:
        db_table = 'authuser'
    def __str__(self):
        return self.auth_name

class User(models.Model):
    username = models.CharField(max_length=30)
    password = models.CharField(max_length=256)
    phone = models.CharField(max_length=11, null=True,blank=True)
    email = models.CharField(max_length=30, null=True,blank=True)
    staute = models.BooleanField(default=False)
    role = models.ForeignKey(Role, on_delete=models.CASCADE)

    class Meta:
        db_table = 'user'

    def __str__(self):
        return self.username

class Cate(BaseModel):
    cate_name = models.CharField(max_length=40)
    cid = models.ForeignKey('self',on_delete=models.CASCADE,null=True,blank=True)
    class Meta:
        db_table = 'cate'

    def __str__(self):
        return self.cate_name



class Color(BaseModel):
    coler_name = models.CharField(max_length=40)
    class Meta:
        db_table = 'cate'

    def __str__(self):
        return self.coler_name


# class Size( )
























